<template>
	<view class="offer">
		<block v-if="show">
			<view class="w96 radius20 bgwhite mt20">
				<view class="w94" style="padding:30rpx 40rpx  0 30rpx;font-size: 24rpx;">
					<text style="color: red;">*</text> 报价快，中选高，报价多少到手多少
				</view>
				<view class="" style="padding: 30rpx 40rpx 40rpx 40rpx ;">
					<view class="flex" style="line-height:2;font-size: 26rpx;">
						<text style="font-size: 80rpx;">￥</text>
						<u--input placeholder="请输入报价金额(不低于30元)" border="bottom" v-model="money" maxlength="5" type="number"
							:fontSize="'20px'" clearable></u--input>
					</view>
					<view class="" style="margin-top: 20rpx;">
						<u--textarea v-model="note" placeholder="给商家留言能提高中选机会" :height="290"></u--textarea>
					</view>
					<view class="" style="width: 100%; height: 20rpx;">

					</view>
				</view>
			</view>
			<view class="mt20">
				<view class="button" style="" @click="submit">
					<!-- <u-button  text="大小尺寸"></u-button> -->
					提交报价
				</view>
			</view>
		</block>
		<block v-else>
			<view class="" style="position: relative;height: 100vh;">
				<view class="mt20 flex-center" style="">
					<image src="@/static/order/success.png" mode="" style="width: 120rpx;height: 120rpx;"></image>
				</view>
				<view class="mt20" style="text-align: center;font-size: 40rpx;">
					您的报价已提交
				</view>
				<view class="bottom-bg" style="">
					<view class="button" style="" @click="step">
						<!-- <u-button  text="大小尺寸"></u-button> -->
						返回首页
					</view>
				</view>
			</view>
		</block>
	</view>
</template>

<script>
	import {
		orderPrice
	} from '@/common/teacherReq';
	export default {
		data() {
			return {
				money: '',
				note: '',
				show: true,
				id: 0,
				type: 0,
			};
		},
		onLoad(opt) {
			console.log('opt: ', opt);
			this.id = opt.id
			this.type = opt.type
			uni.setNavigationBarTitle({
				title: '订单详情'
			})
		},
		methods: {
			submit() {
				console.log('e: ', this.money, this.note);
				orderPrice({
					order_id: this.id,
					price: this.money,
					content: this.note
				}).then(res => {
					this.show = false
					console.log('res: ', res);
				})
				// this.toPage()
				uni.setNavigationBarTitle({
					title: '提交完成'
				})
			},
			step() {
				console.log('step: ----');
				uni.switchTab({
					url:'/pages/index/index'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.offer {
		.bottom-bg {
			width: 100%;
			position: absolute;
			bottom: 0;
			height: 180rpx;
			background-color: #fff;
			box-shadow: -10rpx -10rpx 10rpx #cfcfcf;
			padding: 30rpx;
		}

		.button {
			width: 80%;
			height: 90rpx;
			border-radius: 90rpx;
			background-color: #CEEE5B;
			text-align: center;
			line-height: 2.5;
			margin: 0 auto;
		}
	}
</style>